package com.zmn.plat.common.dictionary;

/**
 * 渠道结算周期
 *
 * @author xiangjunming
 * @since 2020/06/23 14:56:30
 */
public enum ChannelStatementModeEnum {

    /**
     * values
     */
    WEEK(2, "周结"),
    HALF_MONTH(4, "半月结"),
    MONTH(5, "月结"),
    ;

    /**
     * 周结
     */
    public static final int CONSTS_WEEK = 2;
    /**
     * 半月结
     */
    public static final int CONSTS_HALF_MONTH = 4;
    /**
     * 月结
     */
    public static final int CONSTS_MONTH = 5;

    private Integer value;
    private String text;

    ChannelStatementModeEnum(Integer value, String text) {
        this.value = value;
        this.text = text;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public static ChannelStatementModeEnum of(Integer value) {
        if (value == null) {
            return null;
        }
        switch (value) {
            case 2:
                return WEEK;
            case 4:
                return HALF_MONTH;
            case 5:
                return MONTH;
            default:
                return null;
        }
    }

    public static String getText(Integer value) {
        ChannelStatementModeEnum of = of(value);
        return of == null ? null : of.getText();
    }
}
